package com.osfw.activiti.entity.history;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.Date;


/**
 * 流程实例表（核心）
 */
@Data
@Accessors(chain = true)
public class ActHiProcinst implements Serializable {
    private static final long serialVersionUID = 1L;

    /* 流程实例ID */
    @TableId(value = "proc_inst_id_", type = IdType.ASSIGN_ID)
    private Long procInstId;

    /* 流程定义ID */
    @TableField(value = "proc_def_id_")
    private Long procDefId;

    /* 标题 */
    @TableField(value = "title_")
    private String title;

    /* 业务KEY */
    @TableField(value = "busi_key_")
    private String busiKey;

    /* 业务类别 */
    @TableField(value = "busi_type_")
    private String busiType;

    /* 流程发起人ID */
    @TableField(value = "start_user_")
    private Long startUser;

    /* 流程实例的开始时间 */
    @TableField(value = "start_time_")
    private Date startTime;

    /* 流程实例的结束时间 */
    @TableField(value = "end_time_")
    private Date endTime;

    /* 流程实例的开始时间和结束时间中间的执行时长，耗时（单位毫秒） */
    @TableField(value = "duration_")
    private Long duration;

    /* 开始节点KEY */
    @TableField(value = "start_act_key_")
    private String startActKey;

    /* 结束节点KEY */
    @TableField(value = "end_act_key_")
    private String endActKey;

    /* 删除原因 */
    @TableField(value = "delete_reason_")
    private String deleteReason;

    /* 多租户ID */
    @TableField(value = "tenant_id_")
    private Long tenantId;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("procInstId", getProcInstId())
                .append("procDefId", getProcDefId())
                .append("title", getTitle())
                .append("busiType", getBusiType())
                .append("busiKey", getBusiKey())
                .append("startUser", getStartUser())
                .append("startTime", getStartTime())
                .append("endTime", getEndTime())
                .append("duration", getDuration())
                .append("startActKey", getStartActKey())
                .append("endActKey", getEndActKey())
                .append("deleteReason", getDeleteReason())
                .append("tenantId", getTenantId())
                .toString();
    }
}
